home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / daemons / ipServer / RCS / raw.c,v < prev    next >
Encoding:
Text File  |  1990-07-10  |  17.8 KB  |  708 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     90.07.09.11.03.56;  author tve;  state Exp;
  11. branches ;
  12. next     1.4;
  13.  
  14. 1.4
  15. date     89.03.23.09.55.03;  author brent;  state Exp;
  16. branches ;
  17. next     1.3;
  18.  
  19. 1.3
  20. date     88.09.15.09.33.38;  author mendel;  state Exp;
  21. branches ;
  22. next     1.2;
  23.  
  24. 1.2
  25. date     88.08.16.11.17.25;  author mendel;  state Exp;
  26. branches ;
  27. next     1.1;
  28.  
  29. 1.1
  30. date     88.04.27.08.51.44;  author brent;  state Exp;
  31. branches ;
  32. next     ;
  33.  
  34.  
  35. desc
  36. @Raw IP device interface
  37. @
  38.  
  39.  
  40. 1.5
  41. log
  42. @Added a hack to raw sockets: this hack allows user processes which
  43. open a raw socket to send packets which incluse the ip header (i.e.
  44. the ip header is specified by the user process). Currently, the
  45. code only preserves the time-to-live and protocol fields in the
  46. header and fills-in the other ones as usual. This hack is to
  47. support the traceroute program which traces the path taken by ip
  48. packets. It breaks other programs, such as ping, which use raw
  49. sockets. The hack is only enabled if the ipServer is compiled
  50. with REAL_RAW #defined, which is not the default case.
  51. @
  52. text
  53. @/* 
  54.  * raw.c --
  55.  *
  56.  *    Protocol-dependent routines to implement the semantics of
  57.  *    the socket operations defined in inetSocket.c. The routines in
  58.  *    this file handle low-level IP-based protocols for "raw" sockets.
  59.  *    A raw socket is used to send and receive non-UDP and non-TCP packets.
  60.  *    For example, it can be used to send ICMP echo packets.
  61.  *
  62.  * Copyright 1987 Regents of the University of California
  63.  * All rights reserved.
  64.  * Permission to use, copy, modify, and distribute this
  65.  * software and its documentation for any purpose and without
  66.  * fee is hereby granted, provided that the above copyright
  67.  * notice appear in all copies.  The University of California
  68.  * makes no representations about the suitability of this
  69.  * software for any purpose.  It is provided "as is" without
  70.  * express or implied warranty.
  71.  */
  72.  
  73. #ifndef lint
  74. static char rcsid[] = "$Header: /sprite/src/daemons/ipServer/RCS/raw.c,v 1.4 89/03/23 09:55:03 brent Exp $ SPRITE (Berkeley)";
  75. #endif not lint
  76.  
  77.  
  78. #include "sprite.h"
  79. #include "inet.h"
  80. #include "ipServer.h"
  81. #include "stat.h"
  82. #include "raw.h"
  83. #include "socket.h"
  84. #include "sockInt.h"
  85. #include "ip.h"
  86. #include "route.h"
  87.  
  88. /*
  89.  * Maximum amount of data that can be stored in a raw socket's send
  90.  * and receive buffers. 
  91.  */
  92.  
  93. #define RECV_BUF_SIZE    2048
  94. #define SEND_BUF_SIZE    2048
  95.  
  96. static void Output();
  97.  
  98.  
  99.  
  100. /*
  101.  *----------------------------------------------------------------------
  102.  *
  103.  * Raw_SocketOpen --
  104.  *
  105.  *    Does IP-specific actions for opening a new socket. The client
  106.  *    must have the super-user's user ID to open the socket.
  107.  *
  108.  * Results:
  109.  *    SUCCESS            - the socket was initialized.
  110.  *    GEN_NO_PERMISSION    - the client did not have the proper user ID.
  111.  *
  112.  * Side effects:
  113.  *    The max sizes for the send and receive buffers are set.
  114.  *
  115.  *----------------------------------------------------------------------
  116.  */
  117.  
  118. Raw_SocketOpen(sockPtr, userID)
  119.     Sock_SharedInfo    *sockPtr;    /* Socket to be opened. */
  120.     int            userID;        /* Client's user ID. */
  121. {
  122.     if (userID != PROC_SUPER_USER_ID) {
  123.     return(GEN_NO_PERMISSION);
  124.     }
  125.  
  126.     sockPtr->state = READY;
  127.     sockPtr->protocol = NET_IP_PROTOCOL_IP;
  128.     Sock_BufAlloc(sockPtr, SOCK_RECV_BUF, RECV_BUF_SIZE);
  129.     Sock_BufAlloc(sockPtr, SOCK_SEND_BUF, SEND_BUF_SIZE);
  130.     return(SUCCESS);
  131. }
  132.  
  133.  
  134. /*
  135.  *----------------------------------------------------------------------
  136.  *
  137.  * Raw_SocketClose --
  138.  *
  139.  *    Removes data from the socket's read and write queues.
  140.  *
  141.  * Results:
  142.  *    SUCCESS        - always returned.
  143.  *
  144.  * Side effects:
  145.  *    Deallocates buffers in the read and write queues.
  146.  *
  147.  *----------------------------------------------------------------------
  148.  */
  149.  
  150. ReturnStatus
  151. Raw_SocketClose(sockPtr)
  152.     Sock_SharedInfo    *sockPtr;    /* Socket to be closed. */
  153. {
  154.     Sock_BufRemove(sockPtr, SOCK_RECV_BUF, -1);
  155.     Sock_BufRemove(sockPtr, SOCK_SEND_BUF, -1);
  156.     return(SUCCESS);
  157. }
  158.  
  159.  
  160. /*
  161.  *----------------------------------------------------------------------
  162.  *
  163.  * Raw_SocketRead --
  164.  *
  165.  *    Supplies data to a client doing a read on a raw socket.
  166.  *    Normally the packet data is copied to the buffer. If the
  167.  *    packet is smaller than the buffer, no additional packets 
  168.  *    are read so the client will get a short read. If the buffer
  169.  *    is too small, the remaining data in the packet is not saved 
  170.  *    for the next read. Normally, the packet is removed from the
  171.  *    queue and the memory is deallocated once it is read. This
  172.  *    is not the case when the flag NET_PEEK is given.
  173.  *
  174.  * Results:
  175.  *    SUCCESS            - the data were copied to the buffer.
  176.  *    FS_WOULD_BLOCK        - nothing to read.
  177.  *    NET_BAD_OPERATION    - tried to read out-of-band data (not
  178.  *                  defined for this socket type).
  179.  *              
  180.  * Side effects:
  181.  *    The read queue is shortened.
  182.  *
  183.  *----------------------------------------------------------------------
  184.  */
  185.  
  186. ReturnStatus
  187. Raw_SocketRead(privPtr, bufSize, buffer, amountReadPtr)
  188.     Sock_PrivInfo    *privPtr;    /* Ptr to socket's per-process info. */
  189.     int        bufSize;        /* # of bytes in buffer. */
  190.     Address    buffer;            /* Place to put the data. */
  191.     int        *amountReadPtr;        /* # of bytes actually put in buffer. */
  192. {
  193.     ReturnStatus status;
  194.     Sock_SharedInfo    *sharePtr = privPtr->sharePtr;
  195.  
  196.     if ((sharePtr->state != READY) && (sharePtr->state != CONNECTED)) {
  197.     return(NET_BAD_OPERATION);
  198.     }
  199.  
  200.     if (privPtr->recvFlags & NET_OUT_OF_BAND) {
  201.     return(NET_BAD_OPERATION);
  202.     }
  203.  
  204.     status = Sock_BufFetch(sharePtr, privPtr->recvFlags, bufSize, buffer, 
  205.             amountReadPtr, &privPtr->recvFrom);
  206.  
  207.     /*
  208.      * Clear the recvFlags because they are only good for 1 read operation.
  209.      */
  210.     if (status == SUCCESS) {
  211.     privPtr->recvFlags = 0;
  212.     }
  213.  
  214.     return(status);
  215. }
  216.  
  217.  
  218. /*
  219.  *----------------------------------------------------------------------
  220.  *
  221.  * Raw_SocketWrite --
  222.  *
  223.  *    Takes data from a write call by a client and causes the data
  224.  *    to be sent out on the network.
  225.  *
  226.  * Results:
  227.  *    SUCCESS            - the data were sent.
  228.  *    NET_BAD_OPERATION    - the send flags were not 0 (the flag
  229.  *                  values aren't valid for this operation).
  230.  *    FS_BUFFER_TOO_BIG    - the amount of data to send was larger than 
  231.  *                  the amount allowed.
  232.  *
  233.  * Side effects:
  234.  *    The data will be sent in a packet.
  235.  *
  236.  *----------------------------------------------------------------------
  237.  */
  238.  
  239. ReturnStatus
  240. Raw_SocketWrite(privPtr, packetPtr, amtWrittenPtr)
  241.     Sock_PrivInfo    *privPtr;
  242.     IPS_Packet    *packetPtr;        /* Packet containing data to be
  243.                      * sent on the network. */
  244.     int        *amtWrittenPtr;        /* # of bytes sent to the remote host.*/
  245. {
  246.     Sock_SharedInfo    *sharePtr = privPtr->sharePtr;
  247.  
  248.     *amtWrittenPtr = 0;
  249.  
  250.     if (packetPtr->dataLen > 
  251.          Sock_BufSize(sharePtr, SOCK_SEND_BUF, SOCK_BUF_MAX_SIZE)) {
  252.     return(FS_BUFFER_TOO_BIG);
  253.     }
  254.  
  255.     if ((sharePtr->state != READY) && (sharePtr->state != CONNECTED)) {
  256.     return(NET_BAD_OPERATION);
  257.     }
  258.  
  259.  
  260.     if (privPtr->sendInfoValid) {
  261.     /*
  262.      * The send info flags are not valid for raw sockets.
  263.      */
  264.     if (privPtr->sendInfo.flags != 0) {
  265.         return(NET_BAD_OPERATION);
  266.     }
  267.  
  268.     /*
  269.      * See if the client has given us an explicit address about
  270.      * where to send the packet. 
  271.      */
  272.  
  273.     privPtr->sendInfoValid = FALSE;
  274.     if (privPtr->sendInfo.addressValid) {
  275.         /*
  276.          * If the socket's connected, the user can't specify a different
  277.          * destination.
  278.          */
  279.         if (sharePtr->state == CONNECTED) {
  280.         return(NET_ALREADY_CONNECTED);
  281.         }
  282.         sharePtr->sentTo = privPtr->sendInfo.address.inet;
  283.  
  284.     } else {
  285.         /*
  286.          * If the socket's not connected, we don't have a valid 
  287.          * destination address.
  288.          */
  289.         if (sharePtr->state != CONNECTED) {
  290.         return(NET_NOT_CONNECTED);
  291.         }
  292.         sharePtr->sentTo = sharePtr->remote;
  293.     }
  294.  
  295.     } else {
  296.     if (sharePtr->state != CONNECTED) {
  297.         return(NET_NOT_CONNECTED);
  298.     }
  299.     sharePtr->sentTo = sharePtr->remote;
  300.     }
  301.  
  302.     *amtWrittenPtr = packetPtr->dataLen;
  303.  
  304.     Output(sharePtr, sharePtr->local.address, sharePtr->sentTo.address, 
  305.         packetPtr);
  306.  
  307.     return(SUCCESS);
  308. }
  309.  
  310.  
  311. /*
  312.  *----------------------------------------------------------------------
  313.  *
  314.  * Raw_SocketSelect --
  315.  *
  316.  *    Handles raw socket-specific checks to see if a socket is ready for
  317.  *    reading.  The socket is always writable because buffering is not done.
  318.  *
  319.  * Results:
  320.  *    An or'd combination of FS_READBLE and FS_WRITABLE.
  321.  *
  322.  * Side effects:
  323.  *    None.
  324.  *
  325.  *----------------------------------------------------------------------
  326.  */
  327.  
  328. int
  329. Raw_SocketSelect(sockPtr)
  330.     Sock_SharedInfo *sockPtr;    /* Socket to check the readiness of. */
  331. {
  332.     int flags = FS_WRITABLE;
  333.  
  334.     /*
  335.      * The socket is readble only if there's data in the read queue.
  336.      */
  337.     if (Sock_BufSize(sockPtr, SOCK_RECV_BUF, SOCK_BUF_USED) > 0) {
  338.     flags |= FS_READABLE;
  339.     }
  340.     return(flags);
  341. }
  342.  
  343.  
  344. /*
  345.  *----------------------------------------------------------------------
  346.  *
  347.  * Raw_SocketBind --
  348.  *
  349.  *    Assigns the local IP address for the socket. This address is used
  350.  *    to reject incoming packets with an unwanted destination address.
  351.  *
  352.  * Results:
  353.  *    SUCCESS            - the operation was successful.
  354.  *    NET_ADDRESS_NOT_AVAIL    - the caller gave an address that doesn't
  355.  *                  correspond to this host.
  356.  * Side effects:
  357.  *    The local IP address for a socket is assigned.
  358.  *
  359.  *----------------------------------------------------------------------
  360.  */
  361.  
  362. /*ARGSUSED*/
  363. ReturnStatus
  364. Raw_SocketBind(sockPtr, addrPtr, userID)
  365.     register Sock_SharedInfo *sockPtr;    /* Socket to be bound. */
  366.     Net_InetSocketAddr    *addrPtr;    /* Local address to assign to the 
  367.                      * socket. */
  368.     int        userID;            /* User ID of the client. Ignored. */
  369. {
  370.     /*
  371.      * If a specific IP address is given, make sure it is valid for
  372.      * this host (i.e., it is one of the addresses assigned to the host).
  373.      *
  374.      * Only set the SOCK_RAW_HAVE_LOCAL_ADDR flag if a non-wildcard address
  375.      * is given. The port value in addrPtr is ignored.
  376.      */
  377.     if (addrPtr->address != Net_HostToNetInt(NET_INET_ANY_ADDR)) {
  378.     if (!Rte_ValidateAddress(addrPtr->address)) {
  379.         return(NET_ADDRESS_NOT_AVAIL);
  380.     }
  381.     sockPtr->flags |= SOCK_RAW_HAVE_LOCAL_ADDR;
  382.     }
  383.     sockPtr->local = *addrPtr;
  384.     return(SUCCESS);
  385. }
  386.  
  387.  
  388. /*
  389.  *----------------------------------------------------------------------
  390.  *
  391.  * Raw_SocketConnect --
  392.  *
  393.  *    Assigns a remote host address to a socket. From now on, only 
  394.  *    packets from this remote host will be accepted for this socket.
  395.  *
  396.  * Results:
  397.  *    SUCCESS        - always returned.
  398.  *
  399.  * Side effects:
  400.  *    The remote IP address for a socket is assigned.
  401.  *
  402.  *----------------------------------------------------------------------
  403.  */
  404.  
  405. /*ARGSUSED*/
  406. ReturnStatus
  407. Raw_SocketConnect(sockPtr, remoteAddrPtr, initialize)
  408.     register Sock_SharedInfo    *sockPtr;    /* Socket to be connected. */
  409.     Net_InetSocketAddr    *remoteAddrPtr;    /* Remote address to send and receive
  410.                      * datagrams from. */
  411.     Boolean        initialize;    /* Ignored. */
  412. {
  413.     /*
  414.      * If the socket's already connected, disconnect it by zeroing 
  415.      * the remote <address,port> and removing all data in the recv queue.
  416.      */
  417.  
  418.     if (sockPtr->state == CONNECTED) {
  419.     sockPtr->remote.address    = Net_HostToNetInt(NET_INET_ANY_ADDR);
  420.     sockPtr->remote.port    = 0;
  421.     sockPtr->state        = READY;
  422.     Sock_BufRemove(sockPtr, SOCK_RECV_BUF, -1);
  423.     }
  424.  
  425.     sockPtr->remote = *remoteAddrPtr;
  426.     sockPtr->state  = CONNECTED;
  427.  
  428.     return(SUCCESS);
  429. }
  430.  
  431.  
  432. /*
  433.  *----------------------------------------------------------------------
  434.  *
  435.  * Raw_SocketShutdown --
  436.  *
  437.  *    Called by the client when it will not write any more data to 
  438.  *    the socket. Attempts to write data to the socket will fail.
  439.  *
  440.  * Results:
  441.  *    SUCCESS        - always returned.
  442.  *
  443.  * Side effects:
  444.  *    The socket is prevented from sending data.
  445.  *
  446.  *----------------------------------------------------------------------
  447.  */
  448.  
  449. /*ARGSUSED*/
  450. ReturnStatus
  451. Raw_SocketShutdown(sockPtr, how)
  452.     Sock_SharedInfo     *sockPtr;    /* Socket to be shutdown. */
  453.     int            how;        /* Type of shutdown wanted. */
  454. {
  455.     Sock_StopSending(sockPtr);
  456.     return(SUCCESS);
  457. }
  458.  
  459.  
  460. /*
  461.  *----------------------------------------------------------------------
  462.  *
  463.  * Raw_Input --
  464.  *
  465.  *    This routine is called when an IP packet arrives from the network
  466.  *    with a protocol that does not have a handler. The list of open
  467.  *    raw sockets is examined to see if any client wants the packet.
  468.  *    If the client wants the packet, a copy is made and appended to the 
  469.  *    socket's read queue and the client is notified that there's data 
  470.  *    to be read.
  471.  *
  472.  *    The caller of this routine must free the packet.
  473.  *
  474.  * Results:
  475.  *    None.
  476.  *
  477.  * Side effects:
  478.  *    New data is added to the read queue. The waiting client is
  479.  *    woken up.
  480.  *
  481.  *----------------------------------------------------------------------
  482.  */
  483.  
  484. void
  485. Raw_Input(protocol, srcAddr, destAddr, packetPtr)
  486.     int         protocol;    /* Protocol # in IP header. */
  487.     Net_InetAddress    srcAddr;    /* IP address of sender. */
  488.     Net_InetAddress    destAddr;    /* IP address of destination. */
  489.     IPS_Packet        *packetPtr;    /* Packet descriptor. */
  490. {
  491.     register Sock_SharedInfo    *sockPtr;
  492.     Net_InetSocketAddr        sockAddr;
  493.     Address            data;
  494.  
  495.     sockAddr.address = srcAddr;
  496.     sockAddr.port = 0;
  497.  
  498.     /*
  499.      * Go through all open raw sockets and see if anyone wants the packet.
  500.      */
  501.     sockPtr = (Sock_SharedInfo *) NULL;
  502.     while (TRUE) {
  503.     sockPtr = Sock_ScanList(RAW_PROTO_INDEX, sockPtr);
  504.     if (sockPtr == (Sock_SharedInfo *) NULL) {
  505.         break;
  506.     }
  507.  
  508.     /*
  509.      * If the socket wants a specific protocol, make sure the packet's
  510.      * protocol # matches. If the socket's protocol is NET_IP_PROTOCOL_IP,
  511.      * then it will get packets with NET_IP_PROTOCOL_IP and any other
  512.      * protocol.
  513.      */
  514.  
  515.     if ((sockPtr->protocol != NET_IP_PROTOCOL_IP) && 
  516.         (sockPtr->protocol != protocol)) {
  517.         continue;
  518.     }
  519.  
  520.     if ((sockPtr->flags & SOCK_RAW_HAVE_LOCAL_ADDR) &&
  521.         (destAddr != sockPtr->local.address)) {
  522.         continue;
  523.     }
  524.     if ((sockPtr->state == CONNECTED) &&
  525.         (srcAddr != sockPtr->remote.address)) {
  526.         continue;
  527.     }
  528.  
  529.     /*
  530.      * Make sure there's enough room in the buffer before we
  531.      * make a copy of the packet. It's a hack but saves a copy
  532.      * if the buffer can't take the packet.
  533.      */
  534. #ifndef    REAL_RAW
  535.     if (packetPtr->dataLen > Sock_BufSize(sockPtr, SOCK_RECV_BUF, 
  536.             SOCK_BUF_FREE)) {
  537.  
  538.         stats.sock.buffer.append++;
  539.         stats.sock.buffer.appendFail++;
  540.         continue;
  541.     }
  542.     data = malloc((unsigned int) packetPtr->dataLen);
  543.     bcopy(packetPtr->data, data, packetPtr->dataLen);
  544.  
  545.     (void) Sock_BufAppend(sockPtr, SOCK_RECV_BUF, TRUE, packetPtr->dataLen, 
  546.             data, data, &sockAddr, (int *)NULL);
  547. #else    REAL_RAW
  548.     if (packetPtr->dataLen+sizeof(Net_IPHeader) > Sock_BufSize(sockPtr,
  549.         SOCK_RECV_BUF, SOCK_BUF_FREE)) {
  550.  
  551.         stats.sock.buffer.append++;
  552.         stats.sock.buffer.appendFail++;
  553.         continue;
  554.     }
  555.     data = malloc((unsigned int) packetPtr->dataLen+sizeof(Net_IPHeader));
  556.     bcopy(packetPtr->ipPtr, data, sizeof(Net_IPHeader));
  557.     bcopy(packetPtr->data, data+sizeof(Net_IPHeader), packetPtr->dataLen);
  558.  
  559.     (void) Sock_BufAppend(sockPtr, SOCK_RECV_BUF, TRUE,
  560.             packetPtr->dataLen+sizeof(Net_IPHeader),
  561.             data, data, &sockAddr, (int *)NULL);
  562. #endif    REAL_RAW
  563.     Sock_NotifyWaiter(sockPtr, FS_READABLE);
  564.     }
  565. }
  566.  
  567.  
  568. /*
  569.  *----------------------------------------------------------------------
  570.  *
  571.  * Output --
  572.  *
  573.  *    This routine formats an IP packet and causes it to be queued for
  574.  *    output.
  575.  *
  576.  * Results:
  577.  *    None.
  578.  *
  579.  * Side effects:
  580.  *    An IP packet is queued for output.
  581.  *
  582.  *----------------------------------------------------------------------
  583.  */
  584.  
  585. static void
  586. Output(sockPtr, local, remote, packetPtr)
  587.     register Sock_SharedInfo *sockPtr;    /* Socket info for the sender. */
  588.     Net_InetAddress    local;        /* Source address for the packet. */
  589.     Net_InetAddress    remote;        /* Destination of the packet. */
  590.     register IPS_Packet *packetPtr;    /* Packet descriptor. */
  591. {
  592.     int    timeToLive = NET_IP_MAX_TTL;
  593.     int protocol = sockPtr->protocol;
  594.  
  595.     if (!(sockPtr->flags & SOCK_RAW_HAVE_LOCAL_ADDR) ||
  596.     (local == Net_HostToNetInt(NET_INET_ANY_ADDR))) {
  597.     local = Rte_GetOfficialAddr(FALSE);
  598.     }
  599.  
  600. #ifdef    REAL_RAW
  601.     /* If REAL_RAW is defined, we expect the user to give us a complete
  602.      * packet, INCLUDING the (partially filled-in) ip header. For the moment,
  603.      * all we care about in the ip header is the time-to-live and protocol
  604.      * fields. This hack is to support the traceroute program.
  605.      */
  606.     timeToLive = ((Net_IPHeader *)packetPtr->data)->timeToLive;
  607.     protocol = ((Net_IPHeader *)packetPtr->data)->protocol;
  608.     (Address)packetPtr->data += sizeof(Net_IPHeader);
  609.     packetPtr->dataLen -= sizeof(Net_IPHeader);
  610. #endif    REAL_RAW
  611.  
  612.     packetPtr->hdrLen = 0;
  613.     IP_FormatPacket(protocol, timeToLive, local, remote,
  614.             packetPtr);
  615.  
  616.     if (ips_Debug) {
  617.     (void) fprintf(stderr, "(Raw)Output: %d bytes, <%x> --> <%x>\n",
  618.         packetPtr->dataLen, local, remote);
  619.     }
  620.     stats.raw.send.total++;
  621.     stats.raw.send.dataLen += packetPtr->dataLen;
  622.  
  623.     IP_QueueOutput(packetPtr);
  624. }
  625. @
  626.  
  627.  
  628. 1.4
  629. log
  630. @removed include stdio.h
  631. @
  632. text
  633. @d22 1
  634. a22 1
  635. static char rcsid[] = "$Header: raw.c,v 1.3 88/09/15 09:33:38 mendel Exp $ SPRITE (Berkeley)";
  636. d250 2
  637. a254 2
  638.     *amtWrittenPtr = packetPtr->dataLen;
  639.  
  640. d482 1
  641. d495 16
  642. d540 3
  643. d548 12
  644. d561 1
  645. a561 1
  646.     IP_FormatPacket(sockPtr->protocol, NET_IP_MAX_TTL, local, remote,
  647. @
  648.  
  649.  
  650. 1.3
  651. log
  652. @Added/removed byte swapping for SPUR.
  653. @
  654. text
  655. @d22 1
  656. a22 1
  657. static char rcsid[] = "$Header: raw.c,v 1.2 88/08/16 11:17:25 mendel Exp $ SPRITE (Berkeley)";
  658. a34 3
  659.  
  660. #include <stdio.h>
  661.  
  662. @
  663.  
  664.  
  665. 1.2
  666. log
  667. @
  668. @
  669. text
  670. @d22 1
  671. a22 1
  672. static char rcsid[] = "$Header: raw.c,v 1.1 88/04/27 08:51:44 brent Exp $ SPRITE (Berkeley)";
  673. d328 1
  674. a328 1
  675.     if (addrPtr->address != NET_INET_ANY_ADDR) {
  676. d370 1
  677. a370 1
  678.     sockPtr->remote.address    = NET_INET_ANY_ADDR;
  679. d527 1
  680. a527 1
  681.     (local == NET_INET_ANY_ADDR)) {
  682. @
  683.  
  684.  
  685. 1.1
  686. log
  687. @Initial revision
  688. @
  689. text
  690. @d22 1
  691. a22 1
  692. static char rcsid[] = "$Header: raw.c,v 6.0 87/09/08 15:56:03 andrew Stable $ SPRITE (Berkeley)";
  693. d36 1
  694. a36 5
  695. #include "fs.h"
  696. #include "io.h"
  697. #include "mem.h"
  698. #include "sys.h"
  699. #include "byte.h"
  700. d492 2
  701. a493 2
  702.     data = Mem_Alloc(packetPtr->dataLen);
  703.     Byte_Copy(packetPtr->dataLen, packetPtr->data, data);
  704. d536 1
  705. a536 1
  706.     Io_PrintStream(io_StdErr, "(Raw)Output: %d bytes, <%x> --> <%x>\n",
  707. @
  708.